#include <iostream>
#include <unistd.h>
using namespace std;

int main()

{
    pid_t id = fork();
    if(id < 0)
        return 1;
    else if(id != 0)
    {
        int cnt = 5;
        while(cnt)
        {
            cout<<"i am parent,run time:"<<cnt<<endl;
            sleep(1);
            cnt--;
        }
    }
    else
    {
        while(1)
        {
            cout<<"i am child"<<endl;
            sleep(1);
        }
    }
    //int a =0;
    //cout<<"enter anyone:";
    //cin>>a;
    //cout<<a<<endl;
  
    // while(1)
   // {
   //     cout<<"hello"<<endl;
   //     sleep(1);
   // }
    return 0;
}
